<?php
$lastquestion = $this->session->userdata('LastQuestion_' . $data->id);
if ($lastquestion != "") {
    $lastquestion = json_decode(stripcslashes($lastquestion));
}
?>

<script src="<?php echo $baseurl; ?>public/js/Tvshow.js" type="text/javascript"></script>

<script src="<?php echo $baseurl; ?>public/js/analytics_.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $baseurl ?>/public/js/socket.io-1.2.0.js"></script>

<script>

        App.Base_Api = '<?php echo $baseapi ?>';
        
        var User = {
            id: <?php echo $this->session->userdata('id_mem'); ?>,
            username: '<?php echo $this->session->userdata('username_mem'); ?>',
            role: '<?php echo $this->session->userdata('role'); ?>',
            avatar: '<?php echo $this->session->userdata('avatar'); ?>',
            fullname: '<?php echo $this->session->userdata('fullname_mem'); ?>',
            point: 0,
            email: '<?php echo $this->session->userdata('email'); ?>',
            address: '<?php echo $this->session->userdata('address'); ?>',
            mobile: '<?php echo $this->session->userdata('mobile'); ?>',
            birthday: '<?php echo $this->session->userdata('birthday'); ?>',
            isLogin: function () {
                if (this.role == "member")
                    return true;
                return false;
            }
        };
    
        Program.Base_Url_Socket = '<?php echo $socketNode?>';
        Program.id_channel = <?php echo $data->channel_id ?>;
        Program.id_tvshow = <?php echo $data->id ?>;
        Program.background_show = "";
        Program.logo_channel = "";
        Program.name = '<?php echo $data->name ?>';
        Program.id_answer = <?php echo isset($lastquestion->id_answer) ? $lastquestion->id_answer : 0 ?>;
    
    
        Program.before_question = <?php echo isset($lastquestion->id_question) ? $lastquestion->id_question : 0 ?>;
        Program.before_answer = <?php echo isset($lastquestion->id_answer) ? $lastquestion->id_answer : 0 ?>;
        Program.before_tvshow = <?php echo isset($lastquestion->id_tvshow) ? $lastquestion->id_tvshow : 0 ?>;
        Program.before_show = <?php echo isset($lastquestion->id_show) ? $lastquestion->id_show : 0 ?>;
        Program.before_user = <?php echo isset($lastquestion->id_user) ? $lastquestion->id_user : 0 ?>;
    
        Program.Answer.answered_number =<?php echo isset($lastquestion->answer->answered_number) ? $lastquestion->answer->answered_number : 0 ?>;
        Program.Answer.exactly_number = <?php echo isset($lastquestion->answer->exactly_number) ? $lastquestion->answer->exactly_number : 0 ?>;
    
        SocketConnection(function(socketUrl) {
		console.log('socketUrl', socketUrl);
            socket = io.connect(socketUrl, {'force new connection': true});
            Program.runSocket();
            Program.runSocketStatistic();
        });

</script>

<div class="main-body vtv-now">
    <div class="tvshow">

        <div class="name_tvshow"><?php echo $data->name ?></div>

        <div id="Program" class="Question" style="display: none">
        </div>
    </div>
    <div class="clear"></div>
    <div id="Statistic" class="statistics" style="display: none">
        <div class="text-left">Thống kê kết quả trả lời</div>
        <ul class="choice chart-choice">

        </ul>
        <p style="margin-top: 50px">
            <!--            <button class="btn btn-show-answer"></button>-->
            <button class="btn btn-back"></button>
        </p>
    </div>
    <div id="Wait_Vtv" style="display: block">
        <div class="Inside">
            <div id="Logo">
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>

                <figure></figure>

                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
                <figure></figure>
            </div>
            <div id="Now"></div>
        </div>
        <div class="Note" style="display: none">
            <div  class="Inner"></div>
        </div>
    </div>

    <div id="End_Vtv" style="display: none">

    </div>
</div>